home *** CD-ROM | disk | FTP | other *** search
/ DOS Vuser Deluxe 2003 October / DOS Vuser Deluxe 2003 Oct - Disc 1.iso / SKIN / Compact Classic v1.1.wmz / compactclassic.js < prev    next >
Text File  |  2002-10-25  |  3KB  |  119 lines

  1. /* Compact Classic v1.1 */
  2.  
  3. /*
  4.     ⌐2000 Microsoft Corporation. All rights reserved.
  5. */
  6. //<script>
  7. //SKIN MUST INCLUDE res://wmploc/RT_TEXT/#169 as a scriptfile
  8.  
  9. var g_fExpectingSizeChange  = false;
  10. var g_fUserHasSized         = false;
  11.  
  12.  
  13. function OnLoad()
  14. {
  15.     OnOpenStateChange();
  16.     OnPlayStateChange();
  17. }
  18.  
  19.  
  20. function OnURLChange()
  21. {
  22.     if (player.URL == "")
  23.         view.title = xWMP.toolTip;
  24.     else
  25.         view.title = player.URL;
  26. }
  27.  
  28.  
  29. function SizeChange()
  30. {
  31.     if (!g_fExpectingSizeChange)
  32.     {
  33.         g_fUserHasSized = true;
  34.     }
  35. }
  36.  
  37. function StartPlaying()
  38. {
  39.     stereo.backgroundImage = 'icon_stereo.bmp';
  40. }
  41.  
  42. var g_lastImageSourceHeight=-1;
  43. var g_lastImageSourceWidth=-1;
  44.  
  45. function SnapToSize(forceResize)
  46. {
  47.     if (player.openState!=osMediaOpen)
  48.     {
  49.         return;
  50.     }
  51.     
  52.     var isHeight = player.currentMedia.imageSourceHeight;
  53.     var isWidth  = player.currentMedia.imageSourceWidth;
  54.     
  55.     if (isHeight == 0)
  56.     {
  57.         view.height = 359 - 183 - 95;
  58.     }
  59.     else
  60.     {
  61.         if ( (forceResize==false) && (isHeight == g_lastImageSourceHeight) && (isWidth == g_lastImageSourceWidth)) 
  62.         {
  63.             return;
  64.         }
  65.  
  66.         wmlogo.visible = false;
  67.  
  68.         // resize to the video size
  69.         // we'll do this if we're stretch to fit and the user hasn't sized us yet,
  70.         // or if we're not stretch to fit (zoom level is set)
  71.  
  72.         if ((!g_fUserHasSized && mediacenter.videoStretchToFit) || !mediacenter.videoStretchToFit)
  73.         {
  74.             var zoom = mediacenter.videoStretchToFit ? 100 : mediacenter.videoZoom;
  75.  
  76.             var x = (isWidth * (zoom / 100.0));
  77.             if (x < 285) 
  78.             {
  79.                 x = 285;
  80.             }
  81.             var y = (isHeight * (zoom / 100.0));
  82.  
  83.             g_fExpectingSizeChange = true;
  84.             view.width = x;
  85.             view.height = 359 - 183 + y - 95;
  86.             g_fExpectingSizeChange = false;
  87.         }
  88.     }
  89.     g_lastImageSourceWidth = isWidth;
  90.     g_lastImageSourceHeight= isHeight;
  91. }
  92.  
  93. function StopPlaying()
  94. {
  95.     stereo.backgroundImage  = '';
  96.     wmlogo.visible = true;
  97. }
  98.  
  99.  
  100. function OnPlayStateChange()
  101. {
  102.     if(player.PlayState == psUndefined ||
  103.         player.PlayState == psReady)
  104.     {
  105.         StopPlaying();
  106.     }
  107.     else if (player.PlayState == psPlaying)
  108.     {
  109.         StartPlaying();
  110.     }
  111. }
  112.  
  113. function OnOpenStateChange()
  114. {
  115.     if(player.OpenState == osMediaOpen)
  116.     {
  117.         SnapToSize(false);
  118.     }
  119. }